﻿using ParamSetCollection.General.Parameters.Alarms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using ParamSetCollection.General.ParamTable.JTRII.DataTable;
using ParamSetCollection.General.ParamTable.JTRII;
using ParamSetCollection.General.Parameters.Normal;

namespace ParamSetCollection.General.ParamTable
{
    public abstract class ParamHelper
    {

        public ParamGroupUnit ctxParam = null;//系统设置

        public ParamGroupUnit svParam = null;//参数设定值
        public ParamGroupUnit pvParam = null;//实时值

        public ParamGroupUnit ctrlParam = null;//控制参数

        public ParamGroupUnit inputParam = null;//输入
        public ParamGroupUnit outputParam = null;//输出

      

        public AlarmsHelper alarmsHelper = null;

        public string MachineType = "JTR";
        public string PLCType = "MEGMEET";

        public static ParamHelper Instant = null;

        public virtual ParamGroupUnit CtxParam { get; set; }
        public virtual ParamGroupUnit SvParam { get; set; }
        public virtual ParamGroupUnit PvParam { get; set; }
        public virtual ParamGroupUnit CtrlParam { get; set; }
        public virtual ParamGroupUnit InParam { get; set; }
        public virtual ParamGroupUnit OutParam { get; set; }

        public abstract ParameterUnit GetBindingParams(string[] tags);

        public static ParamHelper GetInstant(string machineType, string plcType)
        {
            ParamHelper ph = null;

            if(machineType=="JTR" && plcType=="MEGMEET")
            {
                ph.MachineType = machineType;
                ph.PLCType = plcType;

                ph = new JTRII.JTRIIParamHelper();
                AddrHelper addrHelper = new JTRMegmitAddrHelper();
                addrHelper.SortParams(ph);

            }

            Instant= ph;

            return ph;
        }

        public static JTRIIParamHelper GetJTRParamHelper(string plcType)
        {
            JTRIIParamHelper ph = null;
            if(plcType=="MEGMEET")
            {
                ph = new JTRIIParamHelper();
                ph.PLCType = plcType;
                AddrHelper addrHelper = new JTRMegmitAddrHelper();
                addrHelper.SortParams(ph);

            }

            JTRIIParamHelper.Instant = ph;

            return ph;
        }


    }
}
